package com.codingman.springjpademo1;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Demo1 {
	public static void main(String[] args) {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

		EmployeeDao dao = (EmployeeDao) ctx.getBean(EmployeeDao.class);
		
//		dao.save(new Employee(106, "Michael", 16000));
		
//		dao.update(new Employee(106, "James", 6000));
		
//		dao.delete(106);
		
		List<Employee> list = dao.getAllEmployees();
		for (Employee e : list) {
			System.out.println(e.getId() + " " + e.getName() + " " + e.getSalary());
		}
	}
}
